package rattlesnake.callback.core.strategy;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.HttpObject;
import io.netty.handler.codec.http.HttpRequest;
import rattlesnake.callback.server.HandlerAdapter;

/**
 * @Package: rattlesnake.callback.core.strategy
 * @Description: 策略容器
 * @author: liuxin
 * @date: 17/4/12 上午9:54
 */
public class HandlerAdapterContext {
    
    private HandlerAdapter handlerAdapter;

    /**
     * HandlerFactory根据Url地址，获得具体执行的处理器
     *
     * @param handlerAdapter
     */
    public HandlerAdapterContext(HandlerAdapter handlerAdapter) {
        this.handlerAdapter = handlerAdapter;
    }

    public void operate(ChannelHandlerContext ctx, HttpRequest request, HttpObject msg, String categoryUrl) {
        this.handlerAdapter.forWard(ctx,request,msg, categoryUrl);
    }
}
